/************************************************************
	File:		Entity.h
	Author:		Mitchel Mishiev, Keisuke Miyazaki
	Purpose:	CEntity class controls the Game Objects
************************************************************/
#pragma once
#include "IEntity.h"

enum FaceDirection 
{ 
	eUp = 0,
	eDown,
	eLeft,
	eRight
};

class CEntity : public IEntity
{
protected:
	enum EntityType	  {  ENT_DEFAULT,  ENT_PLAYER,  ENT_ENEMY, ENT_NPC, ENT_KUNAI, ENT_E_KUNAI  };
	EntityType		m_eType;
	FaceDirection	m_eDirection;

public:
	

	CEntity(void);
	~CEntity(void){}

	virtual void	Update( float fElapsedTime )										override;	
	virtual void	Render( void )														override;

	virtual RECT	GetRect( void ) const												override;
	virtual bool	CheckCollision( const IEntity* pEntity1, const IEntity* pEntity2  )	override;
	virtual void	HandleCollision( const IEntity* pOther )							override {}

	virtual void	AddRef( void )									final	{ ++m_unRefCount; }							
	virtual void	Release( void )														final;

	virtual int		GetType( void ) const						override	{ return m_eType; }

	// Accessors:
	int				GetImageID	( void ) const	{	return	m_nImageID;		}
	FaceDirection	GetDirection( void ) const	{	return m_eDirection;	}
	int				GetHealth( void )			{	return m_nHealth;		}
	int				GetAlignmentID( void )		{	return m_nAlignmentID;	}
	int				GetElevation( void ) const	{	return	m_fElevation;	}

	float			GetPosX		( void ) const	{	return	m_fPositionX;	}
	float			GetPosY		( void ) const	{	return	m_fPositionY;	}

	float			GetScaleX	( void ) const	{	return	m_fScaleX;	}
	float			GetScaleY	( void ) const	{	return	m_fScaleY;	}

	float			GetVelX		( void ) const	{	return	m_fVelocityX;	}
	float			GetVelY		( void ) const	{	return	m_fVelocityY;	}
	float			GetRotation	( void ) const	{	return	m_fRotation;	}

	float			GetWidth	( void ) const	{	return	m_fWidth;		}
	float			GetHeight	( void ) const	{	return	m_fHeight;		}
	
	bool			GetAlive	( void ) const	{	return	m_bIsAlive;		}

	
	// Mutators:
	void			SetImageID	( int	_id ) 		{	m_nImageID			= _id;		}
	void			SetDirection( FaceDirection _dir) { m_eDirection = _dir; }
	void			SetHealth	( int	_hp)		{	m_nHealth			= _hp;		}
	void			SetAlignmentID( int _align )	{	m_nAlignmentID		= _align;	}
	void			SetElevation( int	_elevate ) 	{	m_fElevation		= _elevate;	}
	void			SetPosX		( float	_x  ) 		{	m_fPositionX		= _x;		}
	void			SetPosY		( float	_y  ) 		{	m_fPositionY		= _y;		}

	void			SetScaleX	( float	_sx ) 		{	m_fScaleX			= _sx;		}
	void			SetScaleY	( float	_sy ) 		{	m_fScaleY			= _sy;		}

	void			SetVelX		( float	_vx ) 		{	m_fVelocityX		= _vx;		}
	void			SetVelY		( float	_vy ) 		{	m_fVelocityY		= _vy;		}
	void			SetRotation ( float _r	)		{	m_fRotation			= _r;		}
	void			SetWidth	( float	_w  )		{	m_fWidth			= _w;		}
	void			SetHeight	( float	_h  )		{	m_fHeight			= _h;		}

	void			SetAlive	( bool _bool )		{	m_bIsAlive			= _bool;	}

private:
	int				m_nImageID;

	int				m_nHealth;
	int				m_nAlignmentID;
	int				m_fElevation;

	float			m_fPositionX;
	float			m_fPositionY;

	float			m_fScaleX;
	float			m_fScaleY;

	float			m_fVelocityX;
	float			m_fVelocityY;

	float			m_fRotation;

	float			m_fWidth;
	float			m_fHeight;

	bool			m_bIsAlive;

	unsigned int	m_unRefCount;

};

